{extend name='common@layout/base' /}
{block name='breadcrumb'}
<div class="nch-breadcrumb-layout">
    <div class="nch-breadcrumb wrapper"><i class="icon-home"></i>
         <span><a href="{$Think.config.base_url}{$nav_link.1.title|default=''}">{$nav_link.1.title|default=''}</a></span><span class="arrow">></span>
         <span>{$nav_link.2.title|default=''}</span>
    </div>
  </div>
{/block}
{block name='content'}
<script>
var PURL = '{$purl}';
$(document).ready(function(){
    $('#area_info').nc_region();
});
</script>

<link href="/old/shop/templates/new20160622/css/store_list.css?{$Think.config.version_source}" rel="stylesheet" type="text/css">
<link href="/old/data/resource/js/jcarousel/skins/tango/skin.css?{$Think.config.version_source}" rel="stylesheet" type="text/css">

<style type="text/css">
.sticky #main-nav { width: 1198px;}
.jcarousel-skin-tango .jcarousel-clip-horizontal { width: 1000px !important; height: 245px !important;}
.jcarousel-skin-tango .jcarousel-item { height: 245px !important;}
.jcarousel-skin-tango .jcarousel-container-horizontal { width: 1000px !important;}
</style>

<script type="text/javascript" src="/old/shop/resource/js/Jquery.Query.js?{$Think.config.version_source}" charset="utf-8"></script>
<script type="text/javascript">
//<!CDATA[
function ss_replaceParam(key, value)
{
    location.assign($.query.set('key', key).set('order', value).set('curpage',1));
}

function ss_dropParam(key1, key2)
{
	location.assign($.query.REMOVE(key1).REMOVE(key2).REMOVE('curpage'));
}

$(function (){
    var order = '{$s_order}';
    var arrow = '';
    var class_val = 'sort_desc';

    switch (order){
        case 'credit desc' : order = 'credit asc';  class_val = 'sort_desc'; break;
        case 'credit asc'  : order = 'credit desc'; class_val = 'sort_asc' ; break;
        default : order = 'credit asc';
    }
    $('#credit_grade').addClass(class_val);
    $('#credit_grade').click(function(){query('order', order);return false;});
}
);

function query(name, value){
    $("input[name='"+name+"']").val(value);
    $('#searchStore').submit();
}

//]]>
</script>
<div class="content">
<!-- <div class="nc-store-class">
  {if(!empty($class_list) && is_array($class_list))}
  <dl>
    <dt>店铺类目：</dt>
    <dd>
      <a {if ($cate_id==0)} style='color:#bbb' href="javascript:void(0)" {else /} href="{url('index/store/lists')}"  {/if} >全部</a>
      	  {volist name='class_list' key='k' id='v'}
	      <a  {if ($cate_id==$v['id'])} style='color:#bbb' href="javascript:void(0)" {else /} href="{:url('index/store/lists',['cate_id'=>$v.id])}" {/if} >{$v.name}</a>
	      {/volist}
    </dd>
  </dl>
  {/if}
</div> -->

<div class="sort-bar">
  <div class="shop_con_list" id="main-nav-holder">
    <nav class="nc-gl-sort-bar" id="main-nav">
      <form id="store_list" method="GET" action="{:url('index/store/lists')}">
        <input type="hidden" name="order" value="{$s_order}"/>
        <input type="hidden" name="key" value="{$s_key}"/>
        <input type="hidden" name="cate_id" value="{$cate_id}"/>
        <div class="sort-bar">
          <ul class="array">
            <li {if(empty($s_key))} class="selected" {/if} ><a href="javascript:void(0)" class="nobg" onclick="javascript:ss_dropParam('key','order');" title="默认排序">默认</a></li>
            <li {if($s_key == 'store_sales')} class="selected" {/if} ><a href="javascript:void(0)" {if($s_key == 'store_sales')} class="{$s_order}" {/if} onclick="javascript:ss_replaceParam('store_sales','<?php echo ($s_order == 'desc' && $s_key == 'store_sales')?'asc':'desc' ?>');" title="<?php echo ($s_order == 'desc' && $s_key == 'store_sales')?'点击按销量从低到高排序':'点击按销量从高到低排序';  ?>">销量</a></li>
            <li {if($s_key == 'credit')} class="selected" {/if}><a href="javascript:void(0)" {if($s_key == 'credit')} class="{$s_order}" {/if} onclick="javascript:ss_replaceParam('credit','<?php  echo ($s_order == 'desc' && $s_key == 'credit')?'asc':'desc' ?>');" title="<?php  echo ($s_order == 'desc' && $s_key == 'credit')?'点击按信用从低到高排序':'点击按信用从高到低排序'; ?>">信用</a></li>
          </ul>
          <div class="sidebox">
            <h5 class="title">店铺名称：</h5>
            <div class="selectbox">
              <input class="text" type="text" name="keyword" value="{$keyword}" style=" width:150px;"/>
            </div>
          </div>
          <div class="sidebox">
            <h5><label for="area_info">店铺所在地：</label></h5>
            <div class="selectbox">
              <input id="area_info" name="area_info" type="hidden" value="{$s_areainfo}"/>
            </div>
          </div>
          <div class="sidebox width5" style=" background-image: none">
            <div class="selectbox">
              <input class="btn" type="submit" value="搜索" />
            </div>
          </div>
            <div class="sidebox" style="float: right;background-image: none;">
                <h5><label for="area_info">共{$total_num}条记录</label></h5>

            </div>
        </div>
      </form>
    </nav>
  </div>
</div>
<ul class="nc-store-list">
{if(!empty($store_list) && is_array($store_list))}
{volist name='store_list' key='k' id='v'}
    <li class="item">
      <dl class="shop-info">
        <dt class="shop-name"><a href="{:url('index/store/index',['store_id'=>$v.store_id])}" target="_blank">{$v.name|default=''}</a></dt>
        <dd class="shop-pic"><a href="{:url('index/store/index',['store_id'=>$v.store_id])}" title="" target="_blank"><span class="size72"><img src="{$v.label|img_url=360}"  alt="{$v.name|default=''}" title="{$v.name|default=''}" class="size72" /></span></a></dd>
        <dd class="main-runs" title="">主营商品：</dd>
        <dd class="shopkeeper">店主：{$v.member_name}<span>
        {if(!empty($v.qq))}
          <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin={$v.qq}&site=qq&menu=yes" title="QQ: {$v.qq}"><img alt="QQ: {$v.qq}" border="0" src="http://wpa.qq.com/pa?p=2:{$v.qq}:52" style=" vertical-align: middle;"/></a>
        {/if}
        </span></dd>
      </dl>
      <dl class="w200">
        <dd>{$v['goods_count'] ? '商品数量'.$v['goods_count'].'件' : '暂无商品';}</dd>
        <dd>{$v['num_sales_jq'] ? '销量'.$v['num_sales_jq'].'笔' : '暂无销量';}</dd>
        {if (!empty($v['search_list_goods']))}
        <dd class="more-on" attr='morep' nc_type='{$v.store_id}'><span>收起相关商品</span><i></i></dd>
        {/if}
      </dl>
      <dl class="w150">
        <dd>
          {if(empty($store['store_credit_average']))}
          	暂无信用评分
          {else /}
          	信用度：
          <span class="seller-heart level-{$v.store_credit_average}"></span>
          {/if}
        </dd>
        <dd>
        {if (empty($v['store_credit_percent']))}
        	暂无好评数据
        {else /}
        	好评率：{$v.store_credit_percent|default=100}%
        {/if}
        </dd>
        <dd class="shop-rate" nc_type="shop-rate" store_id='{$v.store_id}'>店铺动态评分：<span><i></i></span>
          <div class="shop-rate-con">
              <div class="arrow"></div>
              <dl class="rate">
                {foreach ($v['store_credit'] as $k1=>$v1) }
                  <dt>{$v1.text}：</dt>
                  <dd class="rate-star"><em><i style=" width: {:round($v1['credit']/5*100,2)}%;"></i></em><span>{$v1.credit}分</span></dd>
                {/foreach}
              </dl>
          </div>
          </dd>
      </dl>
      <dl class="w200">
        <dd class="tr">地区：{$v.area_info}</dd>
      </dl> 
      {if(!empty($v['search_list_goods']) && is_array($v['search_list_goods']))}
      <div class="nc-shop-goodslist" nc_type='goods_{$v.store_id}'>
        <div class="arrow"></div>
        <ul class="jcarousel-skin-tango" nc_type="jcarousel" >
        {foreach($v['search_list_goods'] as $k1=>$v1)}
        <li>
            <dl>
              <dt class="goods-pic"><span class="thumb size160"> <i></i> <a href="{:url('index/goods/detail',['goods_id'=>$v1['goods_id']])}" target="_blank"> <img  onload="javascript:DrawImage(this,160,160);" alt="{$v1.goods_name}" src="{$v1.goods_image|img_url=360}"></a></span></dt>
              <dd class="goods-name"><a href="{:url('index/goods/detail',['goods_id'=>$v1['goods_id']])}" title="{$v1.goods_name}" target="_blank">{$v1.goods_name}</a></dd>
              <dd class="goods-price"><em>{$v1.goods_price}</em>{$v1.goods_unit}</dd>
              <dd class="goods-sales">最近成交{$v1.goods_salenum|default=0}笔</dd>
            </dl>
          </li>
         {/foreach}
        </ul>
      </div>
      {/if}
    </li>
      {/volist}
{else /}
<div id="no_results">没有找到符合条件的店铺</div>
{/if}
</ul>
<div class="pagination"> {$page->render()} </div>
</div>
<script type="text/javascript" src="/old/data/resource/js/waypoints.js?{$Think.config.version_source}"></script> 
<script type="text/javascript" src="/old/data/resource/js/jcarousel/jquery.jcarousel.min.js?{$Think.config.version_source}"></script> 

<script type="text/javascript">
$(function(){
    $('[nc_type="jcarousel"]').jcarousel({visible: 4});
    $('[attr="morep"]').click(function(){
    	var id = $(this).attr('nc_type');
    	if($(this).attr('class')=='more-off'){
    		$(this).addClass('more-on').removeClass('more-off').html('收起相关商品<i></i>');
    		$('div[nc_type="goods_'+id+'"]').show();
    	}else{
    		$(this).addClass('more-off').removeClass('more-on').html('展开相关商品<i></i>');
    		$('div[nc_type="goods_'+id+'"]').hide();
    	}
    });
   
});
</script>
{/block}